function _toConsumableArray(a) {
    if (Array.isArray(a)) {
        for (var e = 0, t = Array(a.length); e < a.length; e++) t[e] = a[e];
        return t;
    }
    return Array.from(a);
}

var g, search_value, pages, app = getApp(), page = app.page, request = app.util.request, route = app.route;

function getList() {
    var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : pages;
    request({
        url: "LawList",
        showLoading: !1,
        data: {
            page: t,
            number: app.config.law_number,
            value: search_value
        },
        success: function(a) {
            var e = g.data.lawyer_list;
            e && 1 != t && (a = [].concat(_toConsumableArray(e), _toConsumableArray(a))), g.setData({
                lawyer_list: a
            }), a.length && t * app.config.law_number >= a[0].num && g.setData({
                isLoad: !0
            }), wx.stopPullDownRefresh();
        }
    });
}

page({
    data: {
        isLoad: !1,
        lawyer_list: []
    },
    onLoad: function(a) {
        g = this, search_value = "", pages = 1;
    },
    input: function(a) {
        search_value = a.detail.value;
    },
    search: function() {
        g.setData({
            isLoad: !1
        }), pages = 1, getList();
    },
    onReachBottom: function() {
        !g.data.isLoad && pages++ && getList();
    },
    toInfo: function(a) {
        route({
            url: "shop_info",
            params: {
                id: a.currentTarget.dataset.id
            }
        });
    }
});